/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


package kas.group.pkg3;
import java.util.ArrayList;

/**
 *
 * @author Bárður
 */
public class DataHandler
{
    private ArrayList<Conference> ConferanceList;
    private ArrayList<Hotel> HotelList;
    private ArrayList<Program> ProgramList;
    private ArrayList<People> PeopleList;
    private ArrayList<Instructor> InstructorList;
    
    public DataHandler()
    {
        
        ConferanceList = new ArrayList<>();
        HotelList = new ArrayList<>();
        ProgramList = new ArrayList<>();
        PeopleList = new ArrayList<>();
        InstructorList = new ArrayList<>();
        
        loadTestData();
    }    
    
    private void loadTestData()
    {
        Conference c1 = new Conference();
        c1.addName("Conference 1");
        c1.setDate("09-05-2012");
        c1.setMaxNumberOfPeople(10);
        c1.setPlace("Tórshavn");
        
        Conference c2 = new Conference();
        c2.addName("Conference 2");
        c2.setDate("14-05-2012");
        c2.setMaxNumberOfPeople(25);
        c2.setPlace("Klaksvík");
        
        People p = new People();
        p.addAddress("Street 1");
        p.addCity("Tórshavn");
        p.addCompanion("Companion 1");
        p.addCompanyName("Formula");
        p.addCompanyPhoneNumber(340000);
        p.addDateOfCheckIn("08-05-2012");
        p.addName("person 1");
        p.addPhoneNumber(262455);
        
        People p2 = new People();
        p2.addAddress("Street 1");
        p2.addCity("Tórshavn");
        p2.addCompanion("Companion 1");
        p2.addCompanyName("Formula");
        p2.addCompanyPhoneNumber(340000);
        p2.addDateOfCheckIn("08-05-2012");
        p2.addName("person 2");
        p2.addPhoneNumber(262455);
        
        People p3 = new People();
        p3.addAddress("Street 1");
        p3.addCity("Tórshavn");
        p3.addCompanion("Companion 1");
        p3.addCompanyName("Formula");
        p3.addCompanyPhoneNumber(340000);
        p3.addDateOfCheckIn("08-05-2012");
        p3.addName("person 3");
        p3.addPhoneNumber(262455);
        
        c1.addPeople(p);
        c1.addPeople(p2);
        c1.addPeople(p3);
        
        c2.addPeople(p3);
        
        addConferences(c1);
        addConferences(c2);
        
        Hotel h = new Hotel();
        h.hotelNavn("Hafnia");
        h.dupultkamar(5);
        h.einkultKamar(3);
        
        Hotel h2 = new Hotel();
        h2.hotelNavn("Hotel Føroyar");
        h2.dupultkamar(10);
        h2.einkultKamar(4);
        
        addHotels(h);
        addHotels(h2);
        
        Instructor i = new Instructor();
        i.addAddress("Street 1");
        i.addCity("Tórshavn");
        i.addCompanion("Companion 1");
        i.addCompanyName("Formula");
        i.addCompanyPhoneNumber(340000);
        i.addDateOfCheckIn("08-05-2012");
        i.addName("person 3");
        i.addPhoneNumber(262455);
        
        addInstructor(i);
        
        Program pr = new Program();
        pr.programDato("09-05-2012");
        pr.programNavn("Program1");
        pr.programPrís(100);
        addPrograms(pr);
        
        Program pr2 = new Program();
        pr2.programDato("09-05-2012");
        pr2.programNavn("Program2");
        pr2.programPrís(100);
        addPrograms(pr2);
    }
    
    //Conference
    public ArrayList<Conference> getConferences()
    {
        ArrayList<Conference> temp = new ArrayList<>();
        
        for(Conference c :  ConferanceList)
        {
            temp.add(c);
        }
        
        return temp;
    }
    
    public void addConferences(Conference c)
    {
        ConferanceList.add(c);
    }
    
    public void removeConferences(Conference c)
    {
        ConferanceList.remove(c);
    }
    
    //Hotel
        public ArrayList<Hotel> getHotels()
    {
        ArrayList<Hotel> temp = new ArrayList<>();
        
        for(Hotel h :  HotelList)
        {
            temp.add(h);
        }
        
        return temp;
    }
        
    public void addHotels(Hotel h)
    {
        HotelList.add(h);
    }
    
    public void removeHotels(Hotel h)
    {
        HotelList.remove(h);
    }
    
    //Programs
        public ArrayList<Program> getPrograms()
    {
        ArrayList<Program> temp = new ArrayList<>();
        
        for(Program p :  ProgramList)
        {
            temp.add(p);
        }
        
        return temp;
    }
        
        public void addPrograms(Program p)
    {
        ProgramList.add(p);
    }
        
        public void removePrograms(Program p)
        {
            ProgramList.remove(p);
        }
        
        
    //People
            public ArrayList<People> getPeople()
    {
        ArrayList<People> temp = new ArrayList<>();
        
        for(People p :  PeopleList)
        {
            temp.add(p);
        }
        
        return temp;
    }
        
        public void addPeople(People p)
    {
        PeopleList.add(p);
    }
        
        public void removePeople(People p)
        {
            PeopleList.remove(p);
        }
      
    
    //Instructors
                public ArrayList<Instructor> getInstructors()
    {
        ArrayList<Instructor> temp = new ArrayList<>();
        
        for(Instructor i :  InstructorList)
        {
            temp.add(i);
        }
        
        return temp;
    }
        
        public void addInstructor(Instructor i)
    {
        InstructorList.add(i);
    }
        
        public void removeInstructor(Instructor i)
        {
            InstructorList.remove(i);
        }
    
    
}

